package views
{
	import main.*;
	
	import views.IView;
	import views.interfaces.IAlert;
	
	public class AlertView implements IView
	{
		protected var _alert:IAlert;
		
		public function AlertView()
		{
		}
		
		public function show():void
		{
			if( _alert == null )
			{
				_alert = ViewMng.instance().getUIByName( UIAsset.UI_ALERT ) as _alert;
				
				if( _alert == null )
				{
					return;
				}
				
			}
			
			ViewMng.instance().addPopup( _alert );
			
			_alert.show();
		}
		
		public function close():void
		{
			if( _alert )
				_alert.close();
		}
		
		public function getUIName():String
		{
			return UIAsset.UI_ALERT;
		}
		
		public function isInited():Boolean
		{
			return _alert != null;
		}
		
		public function isShowed():Boolean
		{
			return _alert && _alert.isShowed();
		}
		
		public function showMsg( content:String, title:String = null ):void
		{
			if( _alert )
				_alert.showMsg( content, title );
		}
		
	}
}